/*
****************************************************
Master Do File for Analysis

This file runs all the analysis for the paper
"Can Bridging the Learning Gap Improve Test Scores On A
Key National Exam? Evidence From A Remedial Education
Program in Indian Secondary Schools"

****************************************************
*/

clear
clear all
set more off

*Set location here
cap cd " SET YOUR WORKING DIRECTORY HERE "
cap cd "/Users/chiplunkarg/Library/CloudStorage/Dropbox/Project TN Education/Replication"
global path `c(pwd)'

*Set the system directories
sysdir set PLUS "$path/Code/ado"
sysdir set PERSONAL "$path/Code/ado"

global data = "$path/Data"
global code = "$path/Code"
global tables = "$path/Results/Tables"
global figs = "$path/Results/Figures"


*Setting the scheme for the figures
set scheme s1mono
file close _all 

*************************************************
* Load the data
*************************************************
use "$data/data_analysis.dta", clear


*************************************
*	Creating globals for regressions
************************************
global indcontrols = "female age hindu scst obc"
global schcontrols = "school_tamil numgirls numboys"
global balancevars = "female age hindu scst obc geduc_ill geduc_hs ginc_above10 read math ps ls stu_att"

global baseoutcomes_std = "read_std math_std"
global baseoutcomes = "read math"
global mechanisms = "absent_no_of_days ps time_tuition_ext time_tuition time_study_out_ext time_study_out"


global parentsupp = "ps_school ps_talk ps_hw ps_events"

global pcscores = "ps_pc ls_pc stu_att_pc"
global addscores = "ps ls stu_att"
global att_ls = "ls ls_communication ls_criticalthinking ls_decision ls_goalsetting ls_grit ls_psolving"
global att_stu = "stu_att stu_att_roles stu_att_equalopp stu_att_study stu_att_boysopp stu_att_wiveseduc"

global xthmarks = "pc_ssc_tamil pc_ssc_english pc_ssc_maths pc_ssc_science pc_ssc_ssc pc_ssc_final"

*Setting the repititions for bootstrapping
global reps = 1500

*Sample selection: For those whom we have ASER baseline
keep if have_aserbl == 1 & !missing(read)

 

*Figures: Produces all figures
do "$code/figures.do" 

*Table 1: Balance Table
do "$code/table1.do" 
noi di "Done with Table 1"

*Table 2: ASER Scores
do "$code/table2.do" 
noi di "Done with Table 2"

*Table 3: Mechanisms
do "$code/table3.do" 
noi di "Done with Table 3"

*Tables 4, 5, and A4: Class X scores
do "$code/table4.do" 
noi di "Done with Table 4"

*Table A1: ASER Scores by Treatment
do "$code/tablea1.do" 
noi di "Done with Table A1"

*Table A2
do "$code/tablea2.do" 
noi di "Done with Table A2"

*Class X exams for everyone
do "$code/tablea3.do" 
noi di "Done with Table A3"

*Table Attrition
do "$code/attrition.do" 
noi di "Done with Attrition"

*PowerCalcs: Power calculations for the analysis
do "$code/powercalcs.do" 
noi di "Done with Power Calculations"





















 
